package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iPlayDAO;
import xupt.se.ttms.model.Play;

public class PlaySrv {
	private iPlayDAO playDAO=DAOFactory.creatPlayDAO();
	public boolean add(Play play) throws Exception{
		
		return playDAO.execInsert(play);
	}
	
	public boolean modify(Play play) throws Exception{
		return playDAO.execUpdate(play);	
	}
	
	public boolean delete(int ID) throws Exception{
		return playDAO.execDelete(ID);		
	}
	
	public List<Play> Fetch(int play_id) throws Exception{
		ResultSet resultSet=playDAO.execQuery(play_id);	
		return playDAO.HandlePlayResultSet(resultSet);	
	}
	
	public List<Play> FetchAll() throws Exception{
		ResultSet resultSet=playDAO.exexQueryAll();
		return playDAO.HandlePlayResultSet(resultSet);		
	}
	public List<Play> FetchMv_id(int mv_id) throws Exception{
		ResultSet resultSet=playDAO.execMv_id(mv_id);	
		return playDAO.HandlePlayResultSet(resultSet);	
	}
	public List<Play> FetchPlay(int mv_id,int studio_id,String time) throws Exception{
		ResultSet resultSet=playDAO.execPlay(mv_id, studio_id, time);	
		return playDAO.HandlePlayResultSet(resultSet);	
	}
}
